using System;
using System.Data;
using System.Collections.Generic;
using System.Text;
using BA.DAL;
using Microsoft.VisualBasic;

namespace BlazeApps.Library.Resources
{
    public class ResourceTreeList : Base
    {
        public enum TreeType
        {
            ResourceTree = 0,
            MenuTree = 1,
            CategoriesTree = 2
        }

        public DataSet GetTreeParent(TreeType Type)
        {
            BA.DAL.DBUtility DAL = new BA.DAL.DBUtility();
            DAL.CreateDBObjects(ConnectionString, Provider);

            if (Type == TreeType.ResourceTree)
            {
                return DAL.GetDataSet("usp_get_treeparent", System.Data.CommandType.StoredProcedure, System.Data.ConnectionState.Open);
            }
            else
            {
                return null;
            }
        }

        public DataSet GetTreeChild(string ParentNodeID, TreeType Type)
        {
            BA.DAL.DBUtility DAL = new BA.DAL.DBUtility();
            DAL.CreateDBObjects(ConnectionString, Provider);

            if (Type == TreeType.ResourceTree)
            {
                DAL.AddParameter("@parentnodeid", ParentNodeID);
                return DAL.GetDataSet("usp_get_treechild_byparentid", System.Data.CommandType.StoredProcedure, System.Data.ConnectionState.Open);
            }
            else
            {
                return null;
            }
        }
    }
}
